package com.bw.curl.controller;


import com.alibaba.fastjson.JSON;
import com.bw.curl.entity.PmsCategory;
import com.bw.curl.service.PmsCategoryService;
import com.bw.curl.util.res.R;
import com.bw.curl.util.res.RUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 商品三级分类 前端控制器
 * </p>
 *
 * @author Zeng
 * @since 2023-10-28
 */
// todo test
@RestController
@RequestMapping("/curl/pms-category")
public class PmsCategoryController {

    @Resource
    private PmsCategoryService pmsCategoryService;

    @RequestMapping("/elementTree")
    public R elementTree(){
        List<PmsCategory> tree = pmsCategoryService.listWithTree();
        return RUtils.success(JSON.toJSON(tree));
    }
}

